package com.qj.yantaishan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qj.yantaishan.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserVoMapper extends BaseMapper<UserVo> {
    @Select("select count(*) from shanglala_user")
    int total();

    @Select("select DISTINCT   su.agent_id agent_id,su.uid uid,su.nickname nickname,ssv.id ssv_id,su.phone phone,su.reg_time reg_time,su.last_login_time last_login_time,ss.name storeName,ssud.point point,ssud.cash cash\n" +
            ",ssv.name kry_vip_name,ssvu.is_black is_black from \n" +
            "shanglala_user  su inner join shanglala_store ss on ss.agent_id = su.agent_id  " +
            "inner join shanglala_store_user_data ssud on su.uid=ssud.uid  INNER JOIN shanglala_store_vip_user ssvu  on ssvu.user_id=su.uid left join shanglala_store_vip ssv on ssv.id = ssvu.vip_id limit #{current},#{pageSize}")
    List<UserVo> userList(@Param("current") Integer current, @Param("pageSize") Integer pageSize);

    @Select("update shanglala_store_vip_user set vip_id =#{vipId}, is_black =#{isBlack} where user_id = #{userId}")
    void myUpdate(@Param("vipId") String vipId, @Param("userId") String userId, @Param("isBlack") String isBlack);

}
